#define _CRT_SECURE_NO_WARNINGS 1



#include <stdio.h>

#include <math.h>

int main() {

    int n, sum = 0;

    for (int i = 1; i < 100000; i++)

    {

        int temp = i;

        sum = 0, n = 0;

        while (temp)

        {

            n++;

            temp /= 10;

        }

        temp = i;

        while (temp)

        {

            sum += pow(temp % 10, n);

            temp /= 10;

        }

        if (sum == i)

            printf("%d ", i);

    }

    return 0;



}